import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/api/user/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/vue-admin-template/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/vue-admin-template/user/logout',
    method: 'post'
  })
}

export function getUserList(params) {
  return request({
    url: '/sysUser/list/all',
    method: 'post',
    data: params
  })
}

export function updateUser(params) {
  return request({
    url: '/sysUser/edit',
    method: 'post',
    data: params
  })
}
export function addUser(params) {
  return request({
    url: '/sysUser/add',
    method: 'post',
    data: params
  })
}
export function getUserById(id) {
  return request({
    url: '/sysUser/detail',
    method: 'get',
    params: { 'id': id }
  })
}

export function deleteUserById(id) {
  return request({
    url: '/sysUser/delete',
    method: 'get',
    params: { 'id': id }
  })
}

export function frozenUserById(id) {
  return request({
    url: '/sysUser/frozen',
    method: 'get',
    params: { 'id': id }
  })
}

export function unfrozenUserById(id) {
  return request({
    url: '/sysUser/unfrozen',
    method: 'get',
    params: { 'id': id }
  })
}
